function index(tbl){
	if(!cache.containsKey("pc.index")){
		var cates=$list("cate",Cnd.where("pid","=",0))
		cates.forEach(function(c){
			c.put("list",$list("cate",Cnd.where("pid","=",c.id)))
			c.put("courses",$list("course",Cnd.where("cid1","=",c.id).desc("id"),1,10))
		});
		cache.put("cates",cates)
	
	var zbs=$list("zb",Cnd.where("1","=","1").desc("id"))
	zbs.forEach(function(z){
		z.put("t",$fetch("teacher",Cnd.where("name","=",z.teacher)))
	})
	cache.put("zbs",zbs)
	
	cache.put("course_count",$count("course"))
	var banners=$list("banner",Cnd.where("type","=","edu").desc("id"))
	cache.put("banners",banners)
	
	var likecourse=$list("course",Cnd.where("price",">",0).desc("id"),1,5)
	cache.put("likecourse",likecourse)
	//推荐课
	var hotcourse=$list("course",Cnd.where("0","=",0).desc("id"),1,7)
	cache.put("hotcourse",hotcourse)
	//合作机构
	var agencys=$list("agency",Cnd.where("0","=",0).desc("id"))
	cache.put("agencys",agencys)
	//友情链接 文字
	var friend_link_img=$list("link",Cnd.where("type","=",1))
	cache.put("friend_link_img",friend_link_img)
	var friend_link=$list("link",Cnd.where("type","=",0))
	cache.put("friend_link",friend_link)
	var friend_link_organ=$list("link",Cnd.where("type","=",2))//代理商
	cache.put("friend_link_organ",friend_link_organ)
	var zts=$list("zt",Cnd.where("1","=",1).desc("id"))//专题
	cache.put("zts",zts)
	
	cache.put("pc.index",true)
	}
	if(user()!=null){
			attr("course_count",$count("orders"," status=1 and user_id= "+user().id))
			attr("favorite_count",$count("favorite"," user_id= "+user().id))
	}
	return null;
}
function reg(tbl){
	if(user()!=null){
		return ">>:/users/";
	}
	return sattr("KERBORES_NUTZ_CAPTCHA");
}
function status(tbl){
	
}
function search(tbl){
	if(tbl.type=="course"){
		return ">>:course/?key="+encodeURI(tbl.key);
	}else if(tbl.type=="agency"){
		return ">>:agency/?key="+encodeURI(tbl.key);
	}else if(tbl.type=="teacher"){
		return ">>:teacher/?key="+encodeURI(tbl.key);
	}else{
		return 1;
	}
}
function login(tbl){
	if(user()!=null){
		return ">>:users/";
	}
	return sattr("captcha");
}

function $sess(tbl){
	sattr(tbl.name,foJson(tbl.val))
	return 1;
}
function feed(tbl){
	sattr(tbl.name,foJson(tbl.val))
	return 1;
}
var faq=function(){}
var forget=function(){};